﻿<?
@session_start();
require_once("conn.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>Purchase System</title>
<LINK href="style.css" type="text/css" rel="stylesheet">
<style>
body,input,select{font-family:Zawgyi-one,Zawgyi1;padding:0px;margin:0px;font-size:12px;}
@font-face{font-family: Zawgyi-One;font-style: normal;font-weight: normal;src: url('http://www.mysteryzillion.com/eot/ZAWGYIO3.eot');}
@font-face{font-family: Zawgyi-One;font-style: normal;font-weight: 700;src: url('http://www.mysteryzillion.com/eot/ZAWGYIO2.eot');}
@font-face{font-family: Zawgyi-One;font-style: oblique;font-weight: normal;src: url('http://www.mysteryzillion.com/eot/ZAWGYIO1.eot');}
@font-face{font-family: Zawgyi-One;font-style: oblique;font-weight: 700;src: url('http://www.mysteryzillion.com/eot/ZAWGYIO0.eot');}
</style>
</head>
<body>
<?

	$cmd = $_REQUEST["cmd"];
	switch($cmd){
		case "printNotAccept"		:	printNotAccept();break;
		case "addCategory"			:	addCategory();break;
									
		default						:	echo "Command Error ".$cmd;break;
	}

function printNotAccept(){
	$id = $_REQUEST["id"];
	$sql = "SELECT date(checkDate) as dt FROM pch_accept_order WHERE id='".$id."';";
	$query = mysql_query($sql);
	$row = mysql_fetch_assoc($query);

?>
	<div align="center"><h2>รายการรับของจากใบส่งของเลขที่ : <?=$id?></h2></div>
<?
	$sql = "SELECT th,mm,amount,realamount,unit,sendtime FROM (pch_sendisland_detail as a join product as b on a.item=b.id) left join pch_accept_order_detail as c on a.send_id=c.send_id WHERE a.send_id='".$id."';";
	$query = mysql_query($sql);
	if(mysql_num_rows($query) > 0){
		?>
		<table border="1" width="800">
			<tr>
				<td>ชื่อสินค้า</td>
				<td>Product Name</td>
				<td>Send Amount</td>
				<td>Real Amount</td>
				<td>Unit</td>
				<td>Send Time</td>
			</tr>
		<?
		while($row = mysql_fetch_array($query)){
		?>
			<tr>
				<td><?=$row["th"]?></td>
				<td><?=$row["mm"]?></td>
				<td><?=$row["amount"]?></td>
				<td><?if($row["realamount"] == ""){echo $row["amount"];}else{ echo "<span style='color:red;font-weight:bold;'>".$row["realamount"]."</span>";}?></td>
				<td><?=$row["unit"]?></td>
				<td><?=$row["unit"]?></td>
				<td><?=$row["sendtime"]?></td>
			</tr>
		<?
		}
		?>
		</table>
		<?
	}else{
		echo "No Data";
	}
}

?>
</body>
</html>